<?php
/**
 * Template Name: KnowledgeCenter - FAQ Landing
 * Description: The section page for each KC section
 *
 * @package ManterRealty
 * 
 */

get_header(); ?>
		
        <div class="kc_wrap kc_detail">
        	<?php if ( have_posts() ) : ?>
            	
					<div class="cols cols_2cols kc_cols kc_cols_2cols clearfix">
                   
                    	<div class="col col_1">
                        	<div class="col_pad">
                            
                            	<div class="sec_nav_wrap">
									<div class="sec_nav_pad">
										<ul class="sec_nav">
										<?php
											$parent = 34; // Knowledge Center
											$args=array(
											  'child_of' => $parent
											);
											$pages1 = get_pages($args);  
											if ($pages1) {
											  $pageids = array();
											  foreach ($pages1 as $page) {
												$pageids[]= $page->ID;
											  }
											
											  $args=array(
												'title_li' => '',
												'include' =>  $parent . ',' . implode(",", $pageids)
											  );
											  wp_list_pages($args);
											}
										?> 
										</ul>
									</div>
                                </div>
                                
                                <div class="callout_wrap">
                                	<div class="callout_pad">
                                    	
                                    </div>
                                </div>
                                
                            </div>
                        </div>
                    	
                        <div class="col col_2">
							<div class="kc_section_intro clearfix">
								<div class="kc_section_intro_content">
									<h1><?php the_title(); ?></h1>
									<?php 	
										the_content();
									?>
								</div>
							</div>
							
							<?php 
								$thisSection = $post->ID;
								$parentSlug = get_page($post->post_parent)->post_name;
								
								
								$args = array('category_name' => 'faq_'.$parentSlug);
								echo
								$the_query = new WP_Query( $args );
								
								echo('<ul class="faq_listing">');
								while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
									<li class="faq_item">
										<a href="javascript:;" class="faq_question"><?php the_title(); ?></a>
										<div class="faq_answer"><?php the_content(); ?></div>
									</li>
								<?php 
								endwhile; 
								echo('</ul>');
							?>
                        </div>
						
                    </div>
				
             <?php endif; ?>
        </div>

<?php get_footer(); ?>